<?php
namespace app\index\controller;
use app\BaseController;
use think\request;
use think\Db;
class Alipay extends BaseController{
    public function initialize(){
        session("url",request()->url());
        if(!session('user_id')){
            $redirect_uri=$this->getCurrentUrl()."/index/callback/getuser";
            $url="https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id=".env("APP.ALIPAY_APPID")."&scope=auth_base&redirect_uri=$redirect_uri";
            header("Location:".$url);
        }
    }
//	public function initialize(){
//	    session("url",request()->url());
//
//		if(!session('user_id')){
//			$redirect_uri=$this->getCurrentUrl()."/index/callback/getuser";
//			$url="https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id=2017100709184374&scope=auth_user&redirect_uri=$redirect_uri";
//			header("Location:".$url);
//		}
//	}
	
}